package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
public interface UserMapper {
    /**
     * 根据openid获取用户信息
     * @param openid
     * @return
     */
    @Select("select * from user where openid = #{openid}")
    User getByOpenid(String openid);

    /**
     * 保存用户信息
     * @param user
     */
    void saveUser(User user);

    // 根据id获取用户信息
    @Select("select * from user where id=#{id}")
    User getById(Long userId);

    // 统计用户数量
    Integer countUser(Map<String, Object> map);

}
